<template>
	<view>
		<view style="padding-top: 100rpx;">
			<view class="textArea">
				<text >输入值:</text>
				<input type="text" v-model="title" style="color: red; background-color: #ddd;"/>
			</view>
			<view class="textArea">
				<text>回传值:</text>
				<input type="text" :value="callBackValue" style="color: yellow; background-color: #ddd;"/>
			</view>
			<PassValueComA :intent="title"></PassValueComA>
			<!-- 这里监听触发的函数不能带括号，带括号会导致直接运行而不是事件触发后再运行 -->
			<PassvalueComB @callBackFun="callback"></PassvalueComB>
		</view>
	</view>
</template>

<script>
	import PassValueComA from '../../../components/PassValueComA.vue';
	import PassvalueComB from '../../../components/PassvalueComB.vue';
	
	export default {
		components: {
			PassValueComA,
			PassvalueComB
		},
		data() {
			return {
				title:"",
				callBackValue:""
			}
		},
		methods: {
			callback(msg) {
				console.warn("----Intent----callBack----"+msg);
				console.log(msg);
				this.callBackValue = msg;
			}
		},
		created() {
			uni.$on('getIntent',(msg) => {
				this.r
			})
		}
	}
</script>

<style>
.textArea{
	display: flex;
	margin-bottom: 20px;
}
</style>
